/**
 * 
 */
package graph;

/**
 * @author Michael
 *
 */
public class Graph {
	public int[][] edges;
	public String[] labels;

	/**
	 * Adjacency Array
	 */
	public Graph(String[] labels, int[][] edges) {
		assert labels.length == edges.length && edges.length == edges[0].length;
		this.edges = edges;
		this.labels = labels;
	}

	public boolean hasEdge(int i, int j) {
		if (i < 0 || i >= edges.length ||
			j < 0 || j >= edges.length) {
			return false;
		}
		return edges[i][j] != 0;
	}
	
	public int setEdge(int i, int j, int weight) {
		if (i < 0 || i >= edges.length ||
				j < 0 || j >= edges.length) {
				return 0;
		}
		int result = edges[i][j];
		edges[i][j] = weight;
		return result;
	}

	public int nodes() {
		return edges.length;
	}
	
	public String getLabel(int i) {
		return labels[i];
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		
	}

}
